#ifndef     SCENEMAIN_H
#define      SCENEMAIN_H
#include "scene.h"
#include "node.h"
#include <list>
#include <random>
#include <SDL_mixer.h>

namespace STG{
    class sceneMain : public scene
    {
        public:
            sceneMain();
            ~sceneMain();

            void init();
            void update(float deltaTime);
            void render();
            void clean();
            void handleEvents(SDL_Event* event);
        private:
            player player;
            bulletPlayer bulletPtemp;
            Enemy EnemyTemp;
            bulletEnemy bulletEtemp;
            explosion explosionTemp;
            item itemTemp;
            SDL_Texture* UiLife;
            Mix_Music* bgm = nullptr; // 背景音乐
            float timeEnd = 0;
            //实体相关

            std::list<bulletPlayer*> bulletPList;
            std::list<Enemy*> enemyList;
            std::list<bulletEnemy*> bulletEList;
            std::list<explosion*> explosionList;
            std::list<item*> itemList;

            std::mt19937 gen;//随机数生成器
            std::uniform_real_distribution<float> dis;//随机数分布器

            //渲染相关

            void renderBullet();
            void renderEnemy();
            void renderEnemyBullet();
            void renderExplosion();
            void renderItem();
            void renderUI();

            //更新相关
            void updateBullet(float deltaTime);
            void updateItem(float deltaTime);
            void updatePlayer(float deltaTime);
            void updateExplosion(float deltaTime);
            void updateEnemyBullet(float deltaTime);
            void updateEnemy(float deltaTime);
            void changeSceneDelayed(float deltaTime, float  delayTime, scene* scene);
            //碰撞检测相关

            //其他
            int keyPressed(float deltaTime);
            int playerShoot();
            void playerGetItem(item * item);
            void dropItem(Enemy* enemy);
            SDL_FPoint getDirection(Enemy* enemy);
            void enemyExplode(Enemy* enemy);
            void enemyShoot(Enemy* enemy);
            void spawnEnemy();
    };
};
#endif      /* !SCENEMAIN_H */